//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Base/MetaData/MetaDataCommon.h"
#include "Graphics/MetaData/Meta.ForwardDecl.h"

#ifdef ENGINE_META_DATA
#	include "Graphics/GLshell/RenderState.h"
#endif


#ifdef ENGINE_META_DATA
	namespace MetaData
	{
		using namespace Engine;
		using namespace Engine::Base;
		using namespace Engine::Graphics;

	}	// MetaData
#endif


#include "Base/MetaData/MetaDataUtils.h"
	


	//
	// Color State Separete
	//
#	define META_OBJECT			ColorStateSeparateCfg
#	define META_OBJECT_NAME		TOSTRING( ColorStateSeparate )
#	define META_NAME			MetaColorStateSeparate
#	define META_BASECLASS		RenderState::ColorStateSeparate

#	define META_FIELDS( _decl ) \
		_decl( int,					blendFuncSrcRgb,	blendFuncSrcRGB,	/*ONE*/ 1 ) \
		_decl( int,					blendFuncSrcA,		blendFuncSrcA,		/*ONE*/ 1 ) \
		_decl( int,					blendFuncDstRgb,	blendFuncDstRGB,	/*ZERO*/ 0 ) \
		_decl( int,					blendFuncDstA,		blendFuncDstA,		/*ZERO*/ 0 ) \
		_decl( int,					blendModeRgb,		blendModeRGB,		/*ADD*/ 0x8006 ) \
		_decl( int,					blendModeA,			blendModeA,			/*ADD*/ 0x8006 ) \
		_decl( color4u,				blendColor,			blendColor,			color4u(0xFF) ) \
		_decl( bool,				blend,				blend,				false ) \
		_decl( bool,				maskR,				maskR,				true ) \
		_decl( bool,				maskG,				maskG,				true ) \
		_decl( bool,				maskB,				maskB,				true ) \
		_decl( bool,				maskA,				maskA,				true )
			
#	include "Base/MetaData/MetaDataObject.h"
	


	//
	// Depth State
	//
#	define META_OBJECT			DepthStateCfg
#	define META_OBJECT_NAME		TOSTRING( DepthState )
#	define META_NAME			MetaDepthState
#	define META_BASECLASS		RenderState::DepthState

#	define META_FIELDS( _decl ) \
		_decl( int,					func,				func,			/*LEQUAL*/ 0x0203 ) \
		_decl( bool,				write,				write,			false ) \
		_decl( bool,				test,				test,			false )
	
#	include "Base/MetaData/MetaDataObject.h"
	


	//
	// Stencil State
	//
#	define META_OBJECT			StencilStateCfg
#	define META_OBJECT_NAME		TOSTRING( StencilState )
#	define META_NAME			MetaStencilState
#	define META_BASECLASS		RenderState::StencilState

#	define META_FIELDS( _decl ) \
		_decl( int,					sfail,				sfail,			/*KEEP*/ 0x1E00 ) \
		_decl( int,					dfail,				dfail,			/*KEEP*/ 0x1E00 ) \
		_decl( int,					dppass,				dppass,			/*KEEP*/ 0x1E00 ) \
		_decl( int,					func,				func,			/*ALWAYS*/ 0x0207 ) \
		_decl( uint8,				funcRef,			funcRef,		0 ) \
		_decl( uint8,				funcMask,			funcMask,		-1 ) \
		_decl( uint8,				mask,				mask,			-1 ) \
		_decl( bool,				test,				test,			false )
	
#	include "Base/MetaData/MetaDataObject.h"
	


	//
	// Cull Mode
	//
#	define META_OBJECT			CullModeCfg
#	define META_OBJECT_NAME		TOSTRING( CullMode )
#	define META_NAME			MetaCullMode
#	define META_BASECLASS		RenderState::CullMode

#	define META_FIELDS( _decl ) \
		_decl( bool,				cullBackFace,		cullBackFace,		false ) \
		_decl( bool,				frontFaceCCW,		frontFaceCCW,		true ) \
		_decl( bool,				enabled,			enabled,			false )
	
#	include "Base/MetaData/MetaDataObject.h"
	


	//
	// Polygon Offset
	//
#	define META_OBJECT			PolygonOffsetCfg
#	define META_OBJECT_NAME		TOSTRING( PolygonOffset )
#	define META_NAME			MetaPolygonOffset
#	define META_BASECLASS		RenderState::PolygonOffset

#	define META_FIELDS( _decl ) \
		_decl( float,				factor,				factor,				0 ) \
		_decl( float,				units,				units,				0 ) \
		_decl( bool,				enabled,			enabled,			false )
	
#	include "Base/MetaData/MetaDataObject.h"


	//
	// Render State
	//
#	define META_OBJECT			RenderStateCfg
#	define META_OBJECT_NAME		TOSTRING( RenderState )
#	define META_NAME			MetaRenderState
#	define META_BASECLASS		RenderState

#	define META_FIELDS( _decl ) \
		_decl( ColorStateSeparateCfg,	colorState,			colorState,		) \
		_decl( DepthStateCfg,			depthState,			depthState,		) \
		_decl( StencilStateCfg,			stencilState,		stencilState,	) \
		_decl( CullModeCfg,				cullMode,			cullMode,		) \
		_decl( PolygonOffsetCfg,		polygonOffset,		polygonOffset,	)


#	include "Base/MetaData/MetaDataObject.h"
